# 检测刚才收集的数据
import cv2 as cv
import numpy as np
import pandas as pd
#import tensorflow as tf
#from tensorflow.keras import datasets

"""data=np.load('shuffle_datamin.npy',allow_pickle=True)
#统计各类数据出现次数
data=pd.DataFrame(data)
print(data.head())
keydata=data[1].to_list()
#1*6数组，分别对应ADZJP以及无操作
output = [0,0,0,0,0,0]#初始化
for i in range(len(keydata)):
    output=np.sum([output, keydata[i]], axis=0).tolist()
print(output)
W_num=output[0]
print((data[0][1505][-67]))"""

"""img = cv.imread(r"test.png")
# convert the BGR image to HSV colour space
hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)
# obtain the grayscale image of the original image
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)

# set the bounds for the red hue

lower_red = np.array([8, 215, 134])
upper_red = np.array([19, 253, 255])
lower_blue = np.array([0, 0, 255])
upper_blue = np.array([[109, 23, 255]])

# create a mask using the bounds set
mask = cv.inRange(hsv, lower_red, upper_red)
mask2 = cv.inRange(hsv, lower_blue, upper_blue)
# create an inverse of the mask
mask_inv = cv.bitwise_not(mask)
mask_inv2 = cv.bitwise_not(mask2)
mask_inv = cv.bitwise_and(mask_inv,mask_inv2)
mask = cv.bitwise_xor(mask,mask2)
# Filter only the red colour from the original image using the mask(foreground)
res = cv.bitwise_and(img, img, mask=mask)
# Filter the regions containing colours other than red from the grayscale image(background)
background = cv.bitwise_and(gray, gray, mask=mask_inv)
# convert the one channelled grayscale background to a three channelled image
background = np.stack((background,) * 3, axis=-1)
# add the foreground and the background
added_img = cv.add(res, img)

# create resizable windows for the images
cv.namedWindow("res", cv.WINDOW_NORMAL)
cv.namedWindow("hsv", cv.WINDOW_NORMAL)
cv.namedWindow("mask", cv.WINDOW_NORMAL)
cv.namedWindow("added", cv.WINDOW_NORMAL)
cv.namedWindow("back", cv.WINDOW_NORMAL)
cv.namedWindow("mask_inv", cv.WINDOW_NORMAL)
cv.namedWindow("gray", cv.WINDOW_NORMAL)

# display the images
cv.imshow("back", background)
cv.imshow("mask_inv", mask_inv)
cv.imshow("added", added_img)
cv.imshow("mask", mask)
cv.imshow("gray", gray)
cv.imshow("hsv", hsv)
cv.imshow("res", res)

if cv.waitKey(0):
    cv.destroyAllWindows()"""

# (x,y), (x_val, y_val) = datasets.cifar100.load_data()
# print(x)
# print(y)
# print(x_val)
# print(y_val)
import cv2
data = np.load('train_data.npy', allow_pickle=True)
for each in data:
    img= each[0]
    print(img)
    cv2.imshow('test',img)
    if cv2.waitKey(25)==ord('q'):
        cv2.destroyAllWindows()
        break